<?php
namespace Home\Controller;
use Think\Controller;
class ProductController extends Controller {
	
	/**
	 * 魔术方法，设置默认处理机制
	 * @param String $method
	 * @param String $args
	 */
	public function __call($method, $args){
		if (method_exists('ProductController', $method)){
			$this->$method;
		}else{
			$response['STATUS'] = "error";
			$response['ERRMSG'] = "no method";
			$response['RESULT'] = array();
			$this->ajaxReturn($response);
		}
	}

    public function getProduct(){
		$this->assign('WEB_ROOT',C('WEB_ROOT'));
		
		$id = I('param.id');
		$product=M('product')->where(array("id"=>$id))->find();
		if(empty($product)){
			$this->error('不存在',U('Index/index'));
		}
		$this->assign("product",$product);
		$this->display("product");

	 }
    //public function blog(){
    //    $this->assign('WEB_ROOT',C('WEB_ROOT'));
    //    $this->display("blog");
    //}
    //public function singleblog(){
    //    $this->assign('WEB_ROOT',C('WEB_ROOT'));
    //    $this->display("single-blog");
    //}
}
